<?php

require_once("models/ISearchable.php");

class boatSearch implements ISearchable{
	
    private $m_boatType ;
    private $m_param ;
    
    const NOT_EQUAL = 1 ;
    const EQUAL = 0 ;
    
    
    public function __construct($a_boatType, $a_param) {
        $this->m_boatType = strtolower($a_boatType) ;
        $this->m_param = $a_param ;
    }

	public function isSelected(MemberClass $a_member){

        switch($this->m_param) {
            case self::EQUAL :
				foreach ($a_member->getBoats() as $boat) {
                	if (strtolower($boat->type) == $this->m_boatType) {
                	    
                	    return TRUE ;
                	}
				}
                break ;
            case self::NOT_EQUAL :
				foreach ($a_member->getBoats() as $boat) {
                	if (strtolower($boat->type) != $this->m_boatType) {
                    	return TRUE ;
					}
                }
                break ;
        }
        return FALSE ;
	}
}
